package com.texas_android.app.http;

import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.loopj.android.http.TextHttpResponseHandler;

/**
 * Created by solin on 2017/5/21.
 */

public class Api {


    /**
     * 获取Token(登录)--1
     *
     * @param handler
     */
    public static void LoginIn(AsyncHttpResponseHandler handler, String username, String password) {
        RequestParams params = new RequestParams();
        params.put("phone", username);
        params.put("password", password);
        ApiHttpClient.post("api/login", params, handler);
    }

    /**
     * 查询信息
     *
     * @param handler
     * @param searchTerm
     */
    public static void searchInfo(ResponseHandler handler, String token, String searchTerm) {
        RequestParams params = new RequestParams();
        params.put("token", token);
        params.put("searchTerm", searchTerm);
        ApiHttpClient.post("api/search", params, handler);
    }

    /**
     * 查询基本信息
     *
     * @param handler
     * @param perid
     */
    public static void getEvaluateInfo(ResponseHandler handler, String token, int perid) {
        RequestParams params = new RequestParams();
        params.put("token", token);
        params.put("perssionNo", perid);
        ApiHttpClient.post("api/getEvaluateInfo", params, handler);
    }

    /**
     * 检查版本更新--16
     */
    public static void getVersion(TextHttpResponseHandler handler) {
        RequestParams params = new RequestParams();
//        params.put("uniqueSign", "");
        ApiHttpClient.post("api/dataSync", params, handler);
    }
}
